package cn.qzit.test;

import java.util.function.Function;
import java.util.function.IntPredicate;

public class Lambda2 {
    public static void main(String[] args) {
       //普通写法
        Integer integer = typeConver(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                return Integer.valueOf(s);
            }
        });
        System.out.println(integer);
        //lambda写法
        Integer integer1 = typeConver(s -> Integer.valueOf(s));
        System.out.println(integer1);

    }
    public static <R> R typeConver(Function<String,R> function){
        String str="1235";
        R apply = function.apply(str);
        return apply;
    }
}
